fix(orchestration): don't abort first agent link on 404 contact status#4773
Open
CodeGhost21 wants to merge 1 commit into
Open
fix(orchestration): don't abort first agent link on 404 contact status#4773CodeGhost21 wants to merge 1 commit into
CodeGhost21 wants to merge 1 commit into
Conversation
`link_session` pre-checks `GET /contacts/{id}/status` before sending a
connection request. That endpoint returns 404 when no contact
relationship exists yet — the normal state before you have ever linked
an agent. `contact_status` propagated the 404 as an error, so the
"Link a new agent" UI failed with
HTTP 404: /contacts/<id>/status: not found
and never reached the `POST /contacts/{id}` that actually sends the
request. A first-time link was therefore impossible from the UI.
Treat a 404 from the status pre-check as `"none"` (no relationship yet)
so `link_session` proceeds to send the request. Non-404 errors still
propagate unchanged. `tinyplace::Error::status()` returns `Option<u16>`,
so the 404 is matched precisely rather than by string.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesContact status lookup
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
oxoxDev
approved these changes
Jul 10, 2026
54 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Linking a new agent for the first time is impossible from the UI. In Orchestration → Discover → "Link a new agent", pasting any valid agent ID and clicking Link fails with:
This happens for every agent you have not already linked — i.e. the normal first-contact case.
Root cause
link_session(src/openhuman/agent_orchestration/pairing.rs) pre-checks the relationship viacontact_status, which callsGET /contacts/{id}/status. The backend returns 404 when there is no contact relationship yet.contact_statusran that response throughmap_err(map_err)?, turning the 404 into a hard error that propagated out oflink_sessionbefore it ever reached thePOST /contacts/{id}that sends the request.Verified against staging:
GET /contacts/{id}/statusreturns404pre-link and flips to200 pendingonly after a request is sent — so the 404 is expected state, not a failure.Fix
Treat a 404 from the status pre-check as
"none"(no relationship yet) solink_sessionproceeds to send the request. Other HTTP/transport errors still propagate unchanged.tinyplace::Error::status()returnsOption<u16>, so the 404 is matched precisely rather than by string-sniffing.Testing
mainin the desktop app against staging.request → pending → accept → accepted), proving the backend path is healthy and the 404 is purely the pre-check.🤖 Generated with Claude Code
Summary by CodeRabbit